package com.example.demo.controller;

import com.example.demo.pojo.MessageProducer;
import com.example.demo.pojo.TaskRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class TaskController {

//    @Autowired
//    private MessageProducer messageProducer;
//
//    @PostMapping("/submit-task")
//    public String submitTask(@RequestBody TaskRequest taskRequest) {
//        System.out.println("请求开始" );
//        String taskId = UUID.randomUUID().toString();
//        String taskData = taskRequest.getTaskData();
//        System.out.println("将任务发送到 RabbitMQ 队列" );
//        // 将任务发送到 RabbitMQ 队列
//        messageProducer.sendMessage(taskId + ":" + taskData);
//        System.out.println("任务发送到 RabbitMQ 队列 成功！" );
//        return "{\"taskId\": \"" + taskId + "\"}";
//    }
}
